<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        
        .box {
            position: relative;
            width: 1346px;
            height: 1200px;
            background-image: linear-gradient(to top, pink 50%, orange 100%);
        }
        
        .son {
            position: absolute;
            bottom: 0;
            right: 100px;
            width: 141.5px;
            height: 249px;
            background-image: url(./1.png);
        }
        
        .nd {
            transition: 1s;
            transform: translateY(-1375px);
            opacity: 0;
        }
        
        .ns {
            opacity: 1;
        }
        
        .aniamtion_hj {
            animation: bear 1s steps(4) infinite;
        }
        
        @keyframes bear {
            from {
                background-position: -296px 0;
            }
            to {
                background-position: -892px 0;
            }
        }
    </style>
</head>

<body>
    <div class="box">
        <div class="son"></div>
    </div>

    <script>
        let btn = document.querySelector('.son');

        let step = 19.2;

        let html = document.documentElement;
        console.log(html.scrollTop);
        console.log(btn.scrollTop);
        btn.addEventListener('click', function() {
            btn.classList.add('aniamtion_hj')
            let timer = setInterval(function() {

                html.scrollTop -= step;
                btn.classList.add('nd');
                console.log(btn.scrollTop);
                console.log(html.scrollTop);
                if (html.scrollTop == 0) {
                    clearInterval(timer);
                    btn.classList.remove('nd');
                    btn.classList.remove('aniamtion_hj')

                } // else if (html.scrollTop > 0) {
                // btn.classList.add('ns')
                //}

            }, 16)
        });
    </script>
</body>

</html>